﻿using NHibernate.Proxy;
using System;

namespace Inovout.Models
{
    public static class TypeHelper
    {
        public static Type GetType(object obj)
        {
            INHibernateProxy nhibernateProxyObject = obj as INHibernateProxy;
            if (nhibernateProxyObject == null)
            {
                return  obj.GetType();
            }
            else
            {
                return  nhibernateProxyObject.HibernateLazyInitializer.PersistentClass;
            }
        }
    }
}
